#include <ServoTimer2.h>
#include <Arduino.h>
ServoTimer2 myServo;           //声明舵机
ServoTimer2 myServo2;           //声明舵机

int servo_pin = 11;//定义舵机引脚
int servo_pin2 = 3;//定义舵机引脚
float value_init = 90;//定义舵机初始角度
int jixiebio = 12;
int yuntainie = 7;

void Servo_Init()
{
  myServo.attach(servo_pin);
  myServo2.attach(servo_pin2);
 // myServo.write(map(value_init,0,180,750,2500));
  delay(20);
}

void servo_con2(int value1)
{
  if(value1 > 150){
    value1 = 150;
  }

//    myServo.write(map( 130 ,0,180,500,2500));delay(350);
  
myServo2.write(map( value1 ,0,150,750,2250)); //min 20/mix 150
//    Servo_Move_Single(130,,2);delay(1000);
//    Servo_Move_Single(30,130,3);delay(1000);
  
}
void yuntaijiaodu(int jiaodu){   //500-2500  加大是往前 中间值1100 

    digitalWrite(7,HIGH);
    delayMicroseconds(jiaodu);
    digitalWrite(7,LOW);
    delayMicroseconds(20000-jiaodu);

}

void jixiebi(int jiaodu){   //500-2500  上抬 1300，下放1100
  for(int i = 0; i < 1000; i++){

    digitalWrite(12,HIGH);
    delayMicroseconds(jiaodu);
    digitalWrite(12,LOW);
    delayMicroseconds(20000-jiaodu);
  
  }
}
void servo_con(int value1)
{
  if(value1 > 150){
    value1 = 150;
  }

//    myServo.write(map( 130 ,0,180,500,2500));delay(350);
  
myServo.write(map( value1 ,0,150,750,2250)); //min 20/mix 150
//    Servo_Move_Single(130,,2);delay(1000);
//    Servo_Move_Single(30,130,3);delay(1000);
  
}

